package com.study.bean的生命周期;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试 bean的作用域
 *
 * @author chenhs
 * @date 2019/9/7
 */
public class Test {
	private String xmlPath = "src/main/java/com/study/bean的生命周期/appplictionContext.xml";
	private ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(xmlPath);
	
	@org.junit.Test
	public void Demo() {
		CarService carId = applicationContext.getBean("carId", CarService.class);
		/*只有容器背销毁后才会执行xml中配置的销毁方法*/
		carId.show();
		applicationContext.close();
		
	}

}
